<template>
  <div class="hello">
    <van-grid :column-num="1" v-if="this.GridItem_show == true">
      <van-grid-item class="van-grid-item_my"  @click="gotozjjwarn">
        <div>
          <p class="myh2">区县(项目经理|总监工程师)未考勤查询</p>
          <p>
            考勤时间截止到13点
          </p>
        </div>
      </van-grid-item>
    </van-grid>
  </div>
</template>
<script>
  // 1. 引入你需要的组件
  import {Grid, GridItem, Icon, showDialog} from 'vant';
  // 2. 引入组件样式
  import 'vant/lib/index.css';
  import axios from "axios";
export default {
  name: 'HelloWorld',
  props: {
    msg: String,
  },
  data(){
    return{
      GridItem_show:false
    }
  },
  components: {
    [Grid.name]: Grid,
    [GridItem.name]: GridItem,
    [Icon.name]:Icon,
    [showDialog.name]:showDialog
  },
  mounted() {
    let now = new Date();
    let hour =now.getHours();
    if(hour >= 14){
      this.GridItem_show=true;
    }
  },
  methods: {
    gotozjjwarn(){
      //判断此组件是否可以点击
      var data={
        openid:sessionStorage.getItem('openid'),
        id:this.$route.query['id'],
        page:this.page++
      }
      axios.post('http://bs.bzjsgl.cn/admin/getdata/getzjjPrjAlerts',{data})
              .then(res => {
                // var newList = res.data['data']
                if (res.data['code'] === 20000) {
                  if (res.data['data']['G001'].length > 0) {
                    this.$router.push('/zjjabout'+'?openid=' + sessionStorage.getItem('openid'))
                  }else if(res.data['data']['G014'].length > 0) {
                    this.$router.push('/zjjabout'+'?openid=' + sessionStorage.getItem('openid'))
                  }else {
                    showDialog({
                      message: '没有未考勤项目信息',
                      theme: 'round-button',
                    }).then(() => {
                    });
                  }
                }
                //   for (let i = 0; i < newList.length; i++) {
                //     this.list.push(newList[i]['illustration']);
                //   }
                //   this.loading = false;
                //   if(newList.length == 0) {
                //     this.finished = true;
                //   }
                // }
              })
              .catch(function (error) { // 请求失败处理
                console.log(error)
              })



    }
  }
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h3 {
  margin: 40px 0 0;
}
ul {
  list-style-type: none;
  padding: 0;
}
li {
  display: inline-block;
  margin: 0 10px;
}
a {
  color: #42b983;
}
.active-grid-item {
  /* 自定义点击时的样式 */
  background-color: #f5f5f5;
}
  .myh2{
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 20px;
  }
.van-grid-item_my {
  /*background-color: #f0f0f0 !important;*/
  --van-grid-item-content-background:#f0f0f0
}
</style>




